<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        function debounce(fn,wait){
            var timeout = null
            return function(){
                if(timeout != null){
                    clearTimeout(timeout)
                }
                timeout = setTimeout(fn,wait)
            }
        }

        function handle(){
            console.log(Math.random())
        }

        window.addEventListener('scroll', debounce(handle, 1000))
    </script>
</body>
</html>